package io.afu.dnspod.actions;

import com.alibaba.fastjson.JSON;
import io.afu.dnspod.dto.DomainRecords;
import io.afu.httprequest.HttpRequest;

import java.util.HashMap;
import java.util.Map;

public class DDomain {

    public static DomainRecords getDomainList(String tokenid,String token,String format){
        String loginToken = tokenid+","+token;
        Map<String,Object> params = new HashMap<>();
        params.put("login_token",loginToken);
        params.put("format",format);
        String result = HttpRequest
                .getInstance()
                .setParams(params)
                .setUrl("https://dnsapi.cn/Domain.List")
                .useFormData()
                .post()
                ;
        System.out.println(result);
        DomainRecords domainRecords = JSON.parseObject(result,DomainRecords.class);
        System.out.println(domainRecords.getStatus().getCode());
        return domainRecords;
    }


}
